﻿<?php
require_once(dirname(__FILE__)."/../../libs/login/login.php");  
require_once(dirname(__FILE__)."/../../libs/string/libstr.php");
require_once(dirname(__FILE__)."/../../admin/libs/shuxing_class.php");
$lg=new login();
$lg->checklogin("admin_member");//检验是否登录
$mc=new libstr();
$sx=new shuxing();
$path="自定义属性";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台管理系统</title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){

	$("#dfbtn").click(function(){
    var classname=$("#classname").val();
	var ziduanname=$("#ziduanname").val();
	var classorder=$("#classorder").val();
	var xuanze=$("input[type=radio][name='xuanze']:checked").val();
	var isshow=$("input[type=radio][name='isshow']:checked").val();
	//alert(isshow);
		if(classname==""){
		alert("属性类名不能为空")
			return;
	}
			if(ziduanname==""){
			alert("字段名不能为空")
			return;
		}
		if (/^[a-za-z]+$/.test(ziduanname)) {
			
		}else{
		alert("字段必须是英文字母组成！")
			return;	
		}  

			$.ajax({ 
        type: "POST", 
        url: "../ajax/inc.php", 
        dataType: "text", 
        data: {"dfbtn":true,"classname":classname,"ziduanname":ziduanname,"classorder":classorder,"xuanze":xuanze,"isshow":isshow}, 
        beforeSend: function(){ 
      
        }, 
 success: function(data){
 	//alert(data);
 	  if(data.indexOf("ziduan is exit")!=-1){
    alert("该属性类别已经存在！");
    return;
	  }
	   if(data.indexOf("add is ok")!=-1){
    alert("添加成功！");
    location.href="shuxing_class.php?sx="+ziduanname;
    return;
	  } 
 }
			}) 
		 
		
	})
	
})


</script>
</head>
<body style="background:#fff"> 
<div class="content">
    <div class="right">
<form name="form1" method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="100%" height="24" class="top_head">&nbsp;</td>
          </tr>
          <tr>
            <td valign="top">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="1%" align="right"  height="45">&nbsp;</td>
                    <td width="99%" >
                     <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="55%" style="padding-left:20px;padding-top:10px;"><img src="../images/head.gif" width="13" height="11"><b><?php echo $path;?></b><a href="shuxing_defined_list.php" style=" margin-left:20px; text-decoration:underline;">返回列表</a></td>
                        <td width="45%" align="right">&nbsp;</td>
                      </tr>
                    </table>
                    </td>
                  </tr>
                </table>
            </td>
          </tr>
   </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="liebiao">
  <tr>
    <td width="11%" height="50" align="right">属性名称：</td>
    <td height="50"><input name="classname" type="text" id="classname"  ><Font>
   </Font></td>
    </tr>
  <tr>
    <td height="50" align="right" valign="middle">字段名称：</td>
    <td height="50" valign="middle"><input name="ziduanname" type="text" id="ziduanname"><Font>
   (必须为英文字母)</Font></td>
    </tr>
  <tr>
  <tr>
    <td height="50" align="right" valign="middle">排序：</td>
    <td height="50" valign="middle"><input name="classorder" type="text" id="classorder" value="0"><Font>
  </Font></td>
    </tr>
  <tr>
    <td height="50" align="right" valign="middle">属性选择：</td>
    <td height="50" valign="middle"><div class="kejian"><input name="xuanze" type="radio" value="0" checked>单选&nbsp;<input name="xuanze" type="radio" value="1">多选</div></td>
    </tr>
      <tr>
    <td height="50" align="right" valign="middle">是否可见：</td>
    <td height="50" valign="middle"><div class="kejian"><input name="isshow" type="radio" value="1"  checked>可见&nbsp;<input name="isshow" type="radio" value="0">隐藏</div></td>
    </tr>
  <tr>
    <td height="50" align="right" valign="middle">&nbsp;</td>
    <td height="50" valign="middle"><bdo>
      <input type="button" name="dfbtn" value="提交" id="dfbtn"> <input type="button" name="button" value="返回" onClick="location.href='shuxing_class.php?sx=<?php echo $_GET["sx"];?>'">
    </bdo></td>
    </tr>
    </table>
</form>
</div>
</div>
</body>
</html>
